Chris Pollett > Old Classses >
CS154

( Print View )

Student Corner:
  [Grades Sec1]
  [Grades Sec3]

  [Submit Sec1]
  [Submit Sec3]

  [Class Sign Up Sec1]
  [Class Sign Up Sec3]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Quizzes]

Practice Exams:
  [Mid 1]  [Mid 2]  [Final]

                           












CS154 Spring 2013Practice Midterm 2

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes at least three times. Second and third time try to see how much you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

  1. Let `L = {w | w in {a,b}^\star mbox(, w has an even number of a's and an odd number of b's)}`. Make a right linear grammar from class for this language. Then use the algorithm from class to convert this to a DFA.
  2. Use the construction from class to convert the DFA from the last problem to a regular expression. Consider the homomorphism `h(a) = 01`, `h(b) = 10`. Use the construction from class to convert this regular expression to a regular expression for `h(L)`.
  3. Give a small context free grammar example for some well-known programming language. Briefly explain how a recursive descent parser might be built from this grammar (went over this just before talking about ambiguity).
  4. Consider the CFG G with rules `S -> aBb, B -> epsilon\|S\|BBaBB`. Show step-by-step using the algorithm from class how to convert G to a CFG in Chomsky Normal Form.
  5. Show step-by-step how the CYK algorithm would run on the CNF grammar of the previous problem and the string `abaab`.
  6. Give the PDA for the grammar of Problem 4 (before it was converted to CNF), that results from the algorithm from class for CFG-to-PDA conversion.
  7. Consider the language `L={0^n1^(2^n)| n ge 0}`. Use the pumping lemma to show this language is not context-free.
  8. Prove the context-free languages are not closed under complement. Prove that the intersection of a context-free language by a finite language is context-free.
  9. Give the formal definition of (a) a TM recognizing a language and (b) a TM deciding a language. Give an example of applying each definition.
  10. Draw a diagram of a TM which on input `w` computes and halts with `w#w^R` on the tape.